home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
web
/
spiderweb
/
tools
/
tie
/
error.web
< prev
next >
Wrap
Text File
|
1992-07-05
|
2KB
|
57 lines
@* Reporting errors to the user.
\noindent There may be errors if a line in a given change
file does not match a line in the master file or a
replacement in a previous change file. Such errors are
reported to the user by saying
$$
\hbox{|err_print('! Error message')|.}
$$
Please note that no trailing point is supplied by the error
message because it is appended by |err_print|. Non
recoverable errors are handled by calling |fatal_error| that
outputs a message and then calls `|jump_out()|'.
\leavevmode |err_print| will print the error message
followed by an indication of where the error was spotted in
the source files. |fatal_error| cannot state any files
because the problem is usually to access these.
For |err_print| messages the following procedure is used to
write the proper name of an input file.
@d fatal_error(X) = {print_nl(X); print_ln("."); history=fatal; jump_out();}
@<Error handling...@>=
print_name_of_file(cur_index)
file_index cur_index;
{
fprintf(stderr,"%s",input_organization[cur_index].name_of_file);
}
@ The actual error indications are provided by a procedure
called |err_loc|.
@<Error handling...@>=
err_loc(i) /* prints location of error */
int i;
{
fprintf(stderr,
" (file %s, l.%d).\n",input_organization[i].name_of_file,
input_organization[i].lineno);
@^system dependencies@>
}
@ If it is necessary to abort the job because of a fatal
error, the program calls the `|jump_out()|' procedure, which
does something system-dependent.
@^system dependencies@>
@ The |jump_out()| procedure just cuts across all active
procedure levels and jumps out of the program.
It is implemented by a call to |exit()|.
@^system dependencies@>
@<Error handling...@>=
jump_out() { exit(history==spotless ? 0 : 1);}